package org.jdu.dao;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import junit.framework.TestCase;

public class DatasourceConnectionTest extends TestCase {

	public void testGetConnection() throws DbException {
		try {
			System.setProperty("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
			System.setProperty("java.naming.provider.url", "t3://beatest1wls1.csi.it:7195");
			
			DBConnection db = DBConnectionFactory.getInstance();
			Connection con = db.getConnection("atticonsiglio");
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select sysdate from dual");
			String date = "no-date";
			if(rs.next()){
				date = rs.getString(1);
			}
			System.out.println(date);
			rs.close();
			stmt.close();
			
			con.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
